package data

import (
	"github.com/pkg/errors"
	"yizhuoyan/go-study/pdfgo/raw/objects/basicobject"
)

type AsciiString struct {
	value []byte
}

func (this *AsciiString) GetValue() []byte {
	return this.value
}
func (this *AsciiString) ParseFrom(from *basicobject.ByteString) error {
	bytesValue := from.GetValue()
	for _, b := range bytesValue {
		if b > 127 {
			return errors.Errorf("非法字节，超过127")
		}
	}
	this.value = bytesValue
	return nil
}
